﻿<UserControl x:Class="Microsoft.Research.ScientificWorkflow.ManagementStudioControls.RegistryManagerModule.TypeInitializerCenterPane"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    </UserControl.Resources>
    <Grid>
        <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="4,4,4,4" BorderThickness="1,1,1,1" Background="#FFFFFFFF" BorderBrush="#FFE0E0E0">
            <Grid Margin="0,0,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="36"/>
                    <RowDefinition Height="Auto" MinHeight="67.104"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="60"/>
                </Grid.RowDefinitions>
                <Border CornerRadius="5,5,0,0" Grid.Row="1">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFBFBFB" Offset="0"/>
                            <GradientStop Color="#FFF0F0F0" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <StackPanel Orientation="Horizontal">
                        <Button Command="{Binding Path=ImportCommand}" Style="{DynamicResource ButtonStyleImportBtn}" Width="26" Height="26" Content="Button" x:Name="AddButton_Copy" ToolTip="Import" Margin="5,0,0,0"/>
                        <!--IsEnabled="{Binding Path=CurrentModel.CompleteTypeInitializerModel}"-->
                        <Button Command="{Binding Path=DeleteTypeInitializerCommand}" IsEnabled="False" Visibility="Hidden" Style="{DynamicResource WorkflowDelete}" Width="26" Height="26" Content="Button" x:Name="DeleteButton_Copy" ToolTip="Delete" Margin="5,0,0,0"/>
                    </StackPanel>
                </Border>
                <Grid HorizontalAlignment="Stretch" Margin="0,0,0,0" Grid.ColumnSpan="1" Grid.Row="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="72"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Image Width="72" HorizontalAlignment="Left" VerticalAlignment="Top"
                                   Source="/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ManagementStudio/typeInitHeaderPic.png"/>
                    <TextBlock VerticalAlignment="Top" TextAlignment="Justify" Text="Type initializer enables the user to define the way in which the input is accepted for a custom parameter type through a custom control, thus defining how the application handles these custom parameters. The type initializer will be responsible for string representation, serialization and de-serialization of that custom type and can be plugged into the application.  This catalog will provide the user the information about each type initializer and also enable the maintenance of these type initializers in the application." TextWrapping="Wrap" Margin="10,0,0,0" Grid.Column="1"/>
                </Grid>
                <ScrollViewer Grid.Row="3" Margin="10,10,10,10"  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" >
                    <Grid VerticalAlignment="Stretch" Margin="5,5,5,5">
                        <Grid.RowDefinitions>
                            <!--<RowDefinition Height="Auto" MinHeight="67.104"/>-->
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                      
                        <StackPanel Visibility="{Binding Converter={StaticResource BooleanToVisibilityConverter}, Path=CurrentModel.CompleteTypeInitializerModel}" Margin="0,0,0,0" Grid.Row="0" Grid.RowSpan="1">
                            <Border CornerRadius="5,5,5,5" BorderThickness="0,0,0,0" BorderBrush="#FFC4C4C4" Background="#FFFFFFFF" Margin="60,15,10,0">
                                <Grid Margin="0,0,0,0">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="125"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" MinHeight="20.2"/>
                                        <RowDefinition Height="Auto" MinHeight="6.76000000000001"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto" MinHeight="0"/>
                                        <RowDefinition Height="Auto" MinHeight="0"/>
                                        <RowDefinition Height="Auto" MinHeight="19.44"/>
                                        <RowDefinition Height="Auto" MinHeight="19.44"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto" MinHeight="0"/>
                                        <RowDefinition Height="Auto" MinHeight="0"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Text="ID:" Grid.Row="0" TextWrapping="Wrap" Margin="0,5,5,0"/>
                                    <TextBox Text="{Binding Path=CurrentModel.Id}" AutomationProperties.AutomationId="Id" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True" 
                                             TextWrapping="NoWrap" Grid.Column="1" Grid.Row="0" Width="250" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" IsEnabled="False"/>
                                    <TextBlock HorizontalAlignment="Right" Text="Name:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="1" VerticalAlignment="Top"/>
                                    <TextBox Text="{Binding Path=CurrentModel.Label}" AutomationProperties.AutomationId="Name" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             HorizontalAlignment="Left" Width="250" TextWrapping="NoWrap" Margin="0,5,0,0" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top" IsEnabled="False"/>                                    
                                    <TextBlock HorizontalAlignment="Right" Text="Related Type:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="2" VerticalAlignment="Top"/>
                                    <TextBox Text="{Binding Path=CurrentModel.RelatedType}" AutomationProperties.AutomationId="Name" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             HorizontalAlignment="Left" Width="250" TextWrapping="NoWrap" Margin="0,5,0,0" Grid.Column="1" Grid.Row="2" VerticalAlignment="Top" IsEnabled="False"/>                                    
                                    <TextBlock HorizontalAlignment="Right" Text="Assembly:" TextWrapping="Wrap" Grid.Row="3" Margin="0,5,5,0" VerticalAlignment="Top"/>
                                    <TextBox Text="{Binding Path=CurrentModel.Assembly}" AutomationProperties.AutomationId="Assembly" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             TextWrapping="NoWrap" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="3" VerticalScrollBarVisibility="Auto" Grid.RowSpan="1" IsEnabled="False"/>
                                    <TextBlock Text="Class:" TextWrapping="Wrap" Margin="0,5,5,0" VerticalAlignment="Top" HorizontalAlignment="Right" Grid.Row="4"/>
                                    <TextBox Text="{Binding Path=CurrentModel.Class}" AutomationProperties.AutomationId="Class" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             TextWrapping="NoWrap" HorizontalAlignment="Left" Margin="0,5,0,0" Width="250" VerticalScrollBarVisibility="Auto" Grid.Column="1" Grid.Row="4" VerticalAlignment="Top" IsEnabled="False"/>
                                    <TextBlock Text="Runtime Type:" TextWrapping="Wrap" Margin="0,5,5,0" HorizontalAlignment="Right" Grid.Row="5" Grid.RowSpan="1" VerticalAlignment="Top"/>
                                    <TextBox Text="{Binding Path=CurrentModel.RuntimeType}" AutomationProperties.AutomationId="Runtime" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             TextWrapping="NoWrap" HorizontalAlignment="Left" Margin="0,5,0,0" Width="250" VerticalScrollBarVisibility="Auto" Grid.Column="1" Grid.Row="5" VerticalAlignment="Top" Grid.RowSpan="1" IsEnabled="False"/>
                                    <TextBlock Text="Author:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="6" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                                    <TextBox Text="{Binding Path=CurrentAuthor}" AutomationProperties.AutomationId="Author" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             TextWrapping="NoWrap" HorizontalAlignment="Left" Width="250" VerticalScrollBarVisibility="Auto" Grid.Column="1" Grid.Row="6" VerticalAlignment="Bottom" Margin="0,5,0,0"
                                             MaxLength="300" MaxLines="3"/>
                                    <TextBlock Text="Imported By:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="7" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                                    <TextBox Text="{Binding Path=CurrentModel.CreatedBy}" AutomationProperties.AutomationId="ImportedBy" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             TextWrapping="NoWrap" HorizontalAlignment="Left" Margin="0,5,0,0" Width="250" Grid.Column="1" Grid.Row="7" VerticalAlignment="Top" IsEnabled="False"/>
                                    <TextBlock Text="Created Date:" TextWrapping="Wrap" Grid.Row="8" Margin="0,5,5,0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                                    <TextBox Text="{Binding Path=CurrentModel.CreatedDate}" AutomationProperties.AutomationId="CreatedDate" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             TextWrapping="NoWrap" Grid.Row="8" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250" Margin="0,5,0,0" IsEnabled="False"/>
                                    <TextBlock Text="Modified By:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="9" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                                    <TextBox Text="{Binding Path=CurrentModel.LastModifiedBy}" AutomationProperties.AutomationId="ModifiedBy" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             TextWrapping="NoWrap" HorizontalAlignment="Left" Margin="0,5,0,0" Width="250" IsEnabled="False" Grid.Column="1" Grid.Row="9"/>
                                    <TextBlock Text="Modified Date:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="10" VerticalAlignment="Top" HorizontalAlignment="Right"/>
                                    <TextBox Text="{Binding Path=CurrentModel.LastModifiedTime}" AutomationProperties.AutomationId="ModifiedBy" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}" ToolTipService.ShowOnDisabled="True"
                                             TextWrapping="NoWrap" Margin="0,5,0,0" Grid.Row="10" HorizontalAlignment="Left" VerticalAlignment="Top" Width="250" Grid.Column="1" IsEnabled="False"/>
                                </Grid>
                            </Border>
                            <Border CornerRadius="5,5,5,5" BorderThickness="1,1,1,1" BorderBrush="#FFD6D6D6" Background="#FFFFFFFF" Height="Auto" Margin="0,20,10,10">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="20"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <Border HorizontalAlignment="Stretch" Grid.RowSpan="1" CornerRadius="6,6,0,0" BorderThickness="0,0,0,1" BorderBrush="#FFE4E4E4">
                                        <Border.Background>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFEEEEEE" Offset="0"/>
                                                <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                            </LinearGradientBrush>
                                        </Border.Background>
                                        <TextBlock Text="Related Workflows" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,0,0" FontSize="12"/>
                                    </Border>
                                    <TextBlock Visibility="{Binding Converter={StaticResource BooleanToVisibilityConverter}, Path=CurrentModel.HasNoRelatedWorkflows}" 
                                               Text="No items to be shown" Opacity="0.7" HorizontalAlignment="Center" VerticalAlignment="Center"
                                               AutomationProperties.AutomationId="inputParamsNoItems" Grid.Row="1"  Margin="0,5,0,5"/>
                                    <ListView IsSynchronizedWithCurrentItem="True" ItemContainerStyle="{DynamicResource ListViewItemStyleBasic}" 
                                              BorderBrush="#FFD7D7D7" Margin="10,10,10,10"
                                              Style="{DynamicResource ListViewStyle1}" VerticalAlignment="Top" Grid.Row="1"
                                              Visibility="{Binding Converter={StaticResource BooleanToVisibilityConverter}, Path=CurrentModel.HasRelatedWorkflows}"
                                              SelectionMode="Single" AutomationProperties.AutomationId="relatedWfsListVw" MaxHeight="150" 
                                              ItemsSource="{Binding Path=CurrentModel.RelatedWorkflows}">
                                        <ListView.View>
                                            <GridView>
                                                <GridViewColumn Header="Workflow Name" DisplayMemberBinding="{Binding Path=WorkflowName}" Width="150px" />
                                                <GridViewColumn Header="Created By" DisplayMemberBinding="{Binding Path=Author}" Width="150px" />
                                                <GridViewColumn Header="Last Updated" DisplayMemberBinding="{Binding Path=LastModifiedTime}" Width="150px" />
                                            </GridView>
                                        </ListView.View>
                                    </ListView>
                                </Grid>
                            </Border>
                        </StackPanel>
                    </Grid>
                </ScrollViewer>
                <Border Margin="0,0,0,0" CornerRadius="5,5,0,0" BorderThickness="0,0,0,1" BorderBrush="#FFFFFFFF">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                            <GradientStop Color="#FFE8E8E8" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <TextBlock Text="Type Initializer" TextWrapping="Wrap" FontSize="14" FontWeight="Normal" Margin="7,2,0,0"/>
                </Border>

                <Border BorderBrush="#FFC1C1C1" BorderThickness="0,1,0,0" Padding="0,10,0,0" Grid.Row="4" >
                    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding Converter={StaticResource BooleanToVisibilityConverter}, Path=CurrentModel.CompleteTypeInitializerModel}">
                        <Button HorizontalAlignment="Right" VerticalAlignment="Top" Width="70" Content="Save" Command="{Binding Path=SaveChangesCommand}" Margin="0,0,100,0"/>
                        <Button HorizontalAlignment="Right" Width="70" Content="Cancel" Margin="0,0,20,0" Command="{Binding Path=CancelChangesCommand}" VerticalAlignment="Top"/>
                    </Grid>
                </Border>
            </Grid>
        </Border>
    </Grid>
</UserControl>
